﻿using System;
using System.Web.UI.WebControls;
using ASPNETVN.PORTAL.Modules.ACTP.Components;
using ASPNETVN.PORTAL.Components.UI;
using ASPNETVN.PORTAL.Components.Helpers;

namespace ASPNETVN.PORTAL.Modules.ACTP.Controls
{
    public partial class EmployeeList : ModulePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack == false)
            {
                btnAdd.Visible = this.IsAddable;
                gvList.Columns[gvList.Columns.Count - 1].Visible = this.IsEditable;

                //gvList.DataSource = Employee.SelectCollectionAll(this.ModuleID);
                //gvList.DataBind();
            }
        }

        protected void btnRefresh_Click(object sender, EventArgs e)
        {
            //gvList.DataSource = Employee.SelectCollectionAll(this.ModuleID);
            gvList.DataBind();
        }

        protected void btnAdd_Click(object sender, EventArgs e)
        {
            string url = HttpUrlBuilder.BuildAddEditUrl(this.ModuleID, 0, "AddEditEmployee");
            Response.Redirect(url);
        }
    }
}